<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>没有值的变量返回值undefined</title>
</head>

<body>
    <h1>JavaScript 变量</h1>
    <p>如果变量声明时没有赋值，那么其值是 undefined。</p>
    <p id="demo"></p>
    <script>
        var carName;
        document.getElementById("demo").innerHTML = carName;
    </script>
</body>

</html>